<?php
/**
 * ============================================================================
 * email: ngj6666@126.com
 * url: http://aacms.net
 * ============================================================================
*/

class editor {

	public function create($name, $content, $width=300, $height=300) {	
		global $_G;
		$siteurl = $_G['setting']['siteurl'];
		return '
			<script>var URL = "'.$siteurl.'/static/ueditor/";</script>
			<script type="text/javascript" src="'.$siteurl.'/static/ueditor/editor_config.js"></script>
			<script type="text/javascript" src="'.$siteurl.'/static/ueditor/editor.min.js"></script>
			<link rel="stylesheet" href="'.$siteurl.'/static/ueditor/themes/default/ueditor.css"/>
			
			<textarea id="'.$name.'_editor" name="'.$name.'">'.$content.'</textarea>
			<script type="text/javascript">
				var editor = new UE.ui.Editor();
				editor.render("'.$name.'_editor");
			</script>
		';
	}
	
	public function front_create($name, $content, $width=300, $height=300) {	
		global $_G;
		$siteurl = $_G['setting']['siteurl'];
		return '
			<script>var URL = "'.$siteurl.'/static/ueditor/";</script>
			<script type="text/javascript" src="'.$siteurl.'/static/ueditor/editor_front_config.js"></script>
			<script type="text/javascript" src="'.$siteurl.'/static/ueditor/editor.min.js"></script>
			<link rel="stylesheet" href="'.$siteurl.'/static/ueditor/themes/default/ueditor.css"/>
			
			<textarea id="'.$name.'_editor" name="'.$name.'">'.$content.'</textarea>
			<script type="text/javascript">
				var editor = new UE.ui.Editor();
				editor.render("'.$name.'_editor");
			</script>
		';
	}


}
